<!--
 * @Author: your name
 * @Date: 2021-02-07 13:46:44
 * @LastEditTime: 2021-03-02 17:46:35
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jf-h5\src\page\main\components\TabBar\index.vue
-->
<template>
  <div class="tabbar">
    <div
      :class="['tabbar-item', $store.state.currentTab == index ? 'border-top' : '']"
      v-for="(item, index) in tabbar"
      :key="index"
      @click="addClass(item.path)"
    >
      <img :src="item.img" />
      <span class="text">{{ item.name }}</span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tabbar: [
        {
          name: "基本情况",
          img: require("../../../../../static/img/write-1.png"),
          path: "/jbqk",
        },
        {
          name: "工程管理",
          img: require("../../../../../static/img/write-2.png"),
          path: "/gcgl",
        },
        {
          name: "财务融资",
          img: require("../../../../../static/img/write-3.png"),
          path: "/cwrz",
        },
        {
          name: "制度建设",
          img: require("../../../../../static/img/write-4.png"),
          path: "/zdjs",
        },
        {
          name: "资产管理",
          img: require("../../../../../static/img/write-5.png"),
          path: "/zcgl",
        },
        {
          name: "招标投标",
          img: require("../../../../../static/img/write-6.png"),
          path: "/zbtb",
        },
        {
          name: "党风廉政",
          img: require("../../../../../static/img/write-7.png"),
          path: "/dflz",
        },
        {
          name: "实时动态",
          img: require("../../../../../static/img/write-8.png"),
          path: "/ssdt",
        },
      ]
    };
  },
  methods: {
    addClass(path) {
      this.$router.push('/main' + path);
    },
  },
};
</script>

<style lang='scss' scoped>
.tabbar {
  padding: 0 20px;
  width: 100%;
  height: 160px;
  background: linear-gradient(to top, #063392, #135da6);
  display: flex;
  .tabbar-item {
    flex: 1;
    justify-content: center;
    align-items: center;
    display: flex;
    flex-direction: column;
    width: 70px;
    // margin: 0 10px;
    img {
      width: 35px;
      height: 35px;
    }
    .text {
      text-align: center;
      margin-top: 20px;
      font-size: 20px;
      color: #f9fdf8;
    }
    &.border-top {
      position: relative;
      .text {
        color: #fbd679;
      }

      // border-top: 5px solid #fbd679;
      &::after {
        position: absolute;
        top: 0px;
        content: "";
        height: 5px;
        width: 70px;
        background-color: #fbd679;
      }
    }
  }
}
</style>
